package org.game;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;

public class CardOut {

	public CardOut(Context context,RelativeLayout relativeLayout) {
		mContext=context;
		container = relativeLayout;

	}

	public void show() {
		int left=0,top=0,right=0,bottom=0;
		Card card=null;
		CardView cardView=null;
		
		RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
		RelativeLayout.LayoutParams.WRAP_CONTENT,
		RelativeLayout.LayoutParams.WRAP_CONTENT);
		layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
		
		
		layoutParams.setMargins(left, top, right, bottom);

		card = new Card(Card.Suit.joker, Card.Face.Small, 14);
		cardView = new CardView(mContext, card);
		container.addView(cardView, layoutParams);
	}
	
	public Bitmap getImageFromAssetsFile(String fileName) {
		Bitmap image = null;
		AssetManager am = mContext.getResources().getAssets();
		try {
			InputStream is = am.open(fileName);
			image = BitmapFactory.decodeStream(is);
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

		return image;

	}

	private Context mContext;
	private RelativeLayout container;
}
